localStorage.clear();
var obj = JSON.stringify(["tjy", "dmz", "yqy", "ljk", "dxm", "xjq", "hh"]);
localStorage.setItem("id", obj);
localStorage.setItem("pw", "112233");

var LoginUser = document.querySelector("#exampleInputAmount1");
var LoginPass = document.querySelector("#exampleInputAmount2");
var Img1 = document.querySelector("#img1");
var Img2 = document.querySelector("#img2");
LoginUser.onfocus = function () {
  Img1.src = "../images/Login_Page_User_OnFocus.png";
};
LoginUser.onblur = function () {
  Img1.src = "../images/Login_Page_User_OnBlur.png";
};
LoginPass.onfocus = function () {
  Img2.src = "../images/Login_Page_Pass_OnFocus.png";
};
LoginPass.onblur = function () {
  Img2.src = "../images/Login_Page_Pass_OnBlur.png";
};

var LoginCheck = document.querySelector("#check");
var CheckCount = 0;
LoginCheck.onclick = function () {
  if (CheckCount == 0) {
    this.src = "../images/Login_Page_Check.png";
    CheckCount++;
  } else {
    this.src = "../images/Login_Page_Checked.png";
    CheckCount = 0;
  }
};

var QQ = document.querySelector("#BottomButton1");
var QQBox = document.querySelector("#HoverShow");
var QR = document.querySelector("#HoverMove");
var timer;
QQ.onmouseenter = function () {
  QR.style.left = "0";
  clearTimeout(timer);
};
QR.onmouseenter = function () {
  QR.style.left = "0";
  clearTimeout(timer);
};
QQBox.onmouseleave = function () {
  timer = setTimeout(hide, 400);
};
function hide() {
  QR.style.left = "148px";
}

var LoginBtn = document.querySelector("button");
var Suc = document.querySelector("#SucCont");
document.addEventListener("keypress", LOGIN);
LoginBtn.addEventListener("click", LOGIN);
function LOGIN() {
  if (event.keyCode == "13" || event.target.nodeName == "BUTTON") {
    var idInp = document.querySelectorAll("input")[0].value;
    var pwInp = document.querySelectorAll("input")[1].value;
    var id = JSON.parse(localStorage.getItem("id"));
    var pw = localStorage.getItem("pw");
    for (var i = 0; i < id.length; i++) {
      if (idInp == id[i] && pwInp == pw) {
        Suc.style.top = 0;
        setTimeout(login, 1000);
        return;
        function login() {
          if (idInp == "dmz") {
            location.href = "./Employment_confirmation_management.html";
          } else if (idInp == "tjy") {
            location.href = "./tjy_pages/Personnel_transfers.html";
          } else if (idInp == "dxm") {
            location.href =
              "./dxm_pages/nav_menu.html";
          } else if (idInp == "xjq") {
            location.href = "./xjq_pages/entryPage.html";
          } else if (idInp == "yqy") {
            location.href = "./yqy.html/contract-management.html";
          } else if (idInp == "ljk") {
            location.href = "./ljk-pages/OA管理系统.html";
          }else if (idInp == "hh") {
            location.href = "../hh/pages/leaveManagement.html";
          }
        }
      }
    }
    alert("请输入正确的账号密码");
  }
}
